import { request } from '@umijs/max';
// 获取活动表数据
export async function GetActivity(page,size,status,activity_name,id,start_date,end_date){
    return request(`/api/activity/Activity/?page=${!page? '':page}&size=${!size? '':size}&status=${!status ? '':status}&activity_name=${!activity_name? '':activity_name}&id=${!id? '':id}&created_at__gte=${!start_date? '':start_date}&created_at__lte=${!end_date? '': end_date}`,
    {
      method:"get"
    }
  )
  }
  
  // 添加活动表数据
  export async function PostActivity(data){
    return request(`/api/activity/Activity/`,
    {
      method:"post",
      data:data
    }
  )
  }
  
  // 修改活动表数据
  export async function PatchActivity(id,options){
    return request(`/api/activity/Activity/${id}/`,
    {
      method:"patch",
      data: options
    }
  )
  }
  // 删除活动表数据
  export async function DeleteActivity(id){
    return request(`/api/activity/Activity/${id}/`,
    {
      method:"delete"
    }
  )
  }

  //
  export async function UploadExcel(from){
    return request(`/api/sample/upload/`,
    {
      method:"post",
      data:from
    })
  }
  
  // 
  export async function DownloadExcel(options){
    return request(`/api/sample/download/`,{
      method:"post",
      responseType: 'arraybuffer',
      data:options
    })
  }